package com.lmf.annotation.config;

import com.lmf.annotation.dao.MyDao;
import com.lmf.annotation.dao.MyDao_2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
@ComponentScan({"com.lmf.annotation.dao"})
public class MyConfig_Autowried_2 {


    @Primary
    //将@Autowired 标注在参数上面：从容器中找到该参数，自动进行注入
    @Bean("myDao2")
    public MyDao myDao(@Autowired MyDao_2 myDao_2) {
        return new MyDao();
    }
}
